<?php
//20110605.002
$host = "vsp.pbxsms.com";
$port = 80;
$api = "/api.php";
$username = "username";
$password = "password";
$source = "123456789";
$destination = "44123123123"; //;44654543455;44656565665";
$scheduleTimestamp = 0;
$audio = "AdioDataBase64Encoded";

$apiSock = @fsockopen($host, $port);
if($apiSock) {
  //Basic Call data
  $data = "http=1&username=" . urlencode($username) . "&password=" . urlencode($password) . "&source=" . urlencode($source) . "&";

  //getstatus Call
  $data .= "cmd=getstatus";

  //sendsms Call
  //$data .= "cmd=sendsms&destination=" . urlencode($destination) . "&scheduleTimestamp=" . urlencode($scheduleTimestamp) . "&audio=" . urlencode($audio);

  @fputs($apiSock, "POST " . $api . " HTTP/1.1\r\nHost: " . $host . "\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: " . strlen($data) . "\r\n\r\n" . $data . "\r\n");
  while(!feof($apiSock)) {
    $rs = trim(@fgets($apiSock, 512)) . "\n";
    echo($rs . "\n");
  }
  fclose($apiSock);
}
?>